angular.module('prize').controller('prizeListCtrl', ['$scope', '$http', '$uibModal', '$timeout', function ($scope, $http, $uibModal, $timeout) {
    $scope.dataList = [];
    //初始化数据
    $scope.onInit = function () {
        $http.post(ctx + '/prize/list').then(function (resp) {
            console.log(resp);
            $scope.dataList = resp.data;
        });
    }
    $scope.onInit();
    $scope.successFlag = false;
    //添加或修改
    $scope.editPrize = function (id) {
        var modalInstance = $uibModal.open({
            backdrop: 'static',
            templateUrl: 'app/modules/prize/prize.detail.html',
            controller: 'prizeDetailCtrl',
            resolve: {
                id: function () {
                    return id;
                }
            }
        });
        modalInstance.result.then(function () {
            $scope.successFlag = true;
            $scope.onInit();
            $timeout(function () {
                $scope.successFlag = false;
            }, 1000);
        }, function () {
        });
    };

}]);